From 20994a3ee8203dcbaf3646d5158d1f546acd105f Mon Sep 17 00:00:00 2001 From: Debian Qt/KDE Maintainers Date: Thu, 27 Nov 2025 15:54:31 +0100 Subject: [PATCH] QSQL/ODBC: fix regression (trailing NUL) Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9020034b3b6a3a81 Last-Update: 2023-06-30 When we fixed the callers of toSQLTCHAR() to use the result's size() instead of the input's (which differ, if sizeof(SQLTCHAR) != 2), we exposed callers to the append(0), which changes the size() of the result QVLA. Callers that don't rely on NUL-termination (all?) now saw an additional training NUL. Fix by not NUL-terminating, and changing the only user of SQL_NTS to use an explicit length. Gbp-Pq: Name sql_odbc_fix_unicode_check.diff --- src/plugins/sqldrivers/odbc/qsql_odbc.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index 7a1f2fb18..8fc320ba1 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -125,7 +125,6 @@ inline static QVarLengthArray toSQLTCHAR(const QString &input) { QVarLengthArray result; toSQLTCHARImpl(result, input); - result.append(0); // make sure it's null terminated, doesn't matter if it already is, it does if it isn't. return result; } -- 2.30.2